package com.houger.ddd.seckill.infra.datamanager;

import com.houger.ddd.datamanager.manager.aop.DataCache;
import com.houger.ddd.datamanager.manager.aop.DataCacheEvict;
import com.houger.ddd.datamanager.utils.CacheType;
import org.springframework.stereotype.Component;

/**
 * @author Houger.
 * @date 2024年05月31日 17:15.
 */
@Component
public class SeckillDataManager {
    @DataCache(group = "captcha",key = "('instanceId=' + #instanceId) + (':userId=' + #userId)",
        type = {CacheType.REDIS},redisExpire = 5 * 60)
    public String getCaptchaOrSet(final Long instanceId, final Long userId, final String verCode) {
        return verCode;
    }

    @DataCacheEvict(group = "captcha",key = "('instanceId=' + #instanceId) + (':userId=' + #userId)",type = {CacheType.REDIS})
    public void evictCaptcha(Long instanceId, Long userId){

    }
}
